// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import Vant from 'vant'
import wx from 'weixin-js-sdk'
import '../node_modules/vant/lib/index.css';
import VueWechatTitle from 'vue-wechat-title';  
Vue.use(VueWechatTitle)
Vue.use(Vant);

Vue.config.productionTip = false

router.afterEach(route => {
  console.log(route)
  // 从路由的元信息中获取 title 属性
  if (route.meta.title) {
      document.title = route.meta.title;
      console.log(navigator.userAgent)
      // 如果是 安卓 设备，则使用如下 hack 的写法实现页面标题的更新
      // if (navigator.userAgent.indexOf('Android') > -1 || u.indexOf('Linux') > -1) {
      //     const hackIframe = document.createElement('iframe');
      //     hackIframe.style.display = 'none';
      //     hackIframe.src = '/static/html/fixIosTitle.html?r=' + Math.random();
      //     document.body.appendChild(hackIframe);
      //     setTimeout(_ => {
      //         document.body.removeChild(hackIframe)
      //     }, 300)
      // }
  }
})

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})
